{% extends request.resolver_match.app.base_template_name|default:'viewflow/base_page.html' %}
{% load i18n viewflow %}


{% block content %}
  <div class="mdc-layout-grid vf-page__grid">
    <div class="mdc-layout-grid__inner vf-page__grid-inner">
      {% block confirm-cell %}
        <div class="mdc-layout-grid__cell {% block detail-cell-span %}mdc-layout-grid__cell--span-10-desktop mdc-layout-grid__cell--span-8-tablet mdc-layout-grid__cell--span-4-phone{% endblock %}">
          <div class="mdc-card vf-card">
            <section class="vf-card__header">
              <h1 class="vf-card__title">{{ view.model|verbose_name_plural|title }}</h1>
              <h2 class="vf-card__breadcrumbs">
                <a href="{% current_viewset_reverse viewset 'list' %}">{{ view.model|verbose_name_plural|title }}</a>
                <a>{% trans 'Delete' %}</a>
              </h2>
            </section>
            <vf-form>
              <form class="vf-form" method="POST" {% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
                {% csrf_token %}
                {{ form }}
                <section class="vf-card__form">
                  <h3 class="vf-card__alert">
                    {% if view.objects_count  %}
                      {% blocktrans with name=view.model|verbose_name plural_name=view.model|verbose_name_plural count objects_count=view.objects_count %}
                        Are you sure you want to delete the {{ name }} and related items?
                      {% plural %}
                        Are you sure you want to delete the {{ objects_count }} {{ plural_name }} and related items?
                      {% endblocktrans %}
                    {% else %}
                      {% blocktrans with plural_name=view.model|verbose_name_plural %}
                        Are you sure you want to delete all {{ plural_name }} and related items?
                      {% endblocktrans %}
                    {% endif %}
                  </h3>
                  {% for model, objects in deleted_objects %}
                    <h3 class="mdc-typography--headline5">{{ model|verbose_name_plural|title }}</h3>
                    {% for object in objects %}
                      {% get_absolute_url site object as object_url %}
                      {% if object_url %}<a class="mdc-typography--body1" target="_blank" href="{{ object_url }}">{{ object }}</a>{% else %}{{ object }}{% endif %}{% if not forloop.last %},&nbsp;{% endif %}
                    {% endfor %}
                  {% endfor %}
                </section>
                <section class="mdc-card__actions vf-card__actions">
                  <a class="mdc-button mdc-card__action mdc-card__action--button" name="_confirm" style="margin-right: auto;" onclick="window.history.back(-1)"><i class="material-icons">arrow_back</i>&nbsp;&nbsp;{% trans "Back" %}  </a>
                  <input class="mdc-button mdc-card__action mdc-card__action--button mdc-button--raised" type="submit" name="_confirm" value="{% trans "Delete" %}">
                </section>
              </form>
            </vf-form>
          </div>
          </div
      {% endblock confirm-cell %}
    </div>
  </div>
{% endblock content %}
